home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / src-server / wc_MainW.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-04  |  7.2 KB  |  212 lines

  1. /* -*-C-*-
  2. ********************************************************************************
  3. *
  4. * File:         wc_MainW.c
  5. * RCS:          $Header: wc_MainW.c,v 1.3 91/03/14 03:14:51 mayer Exp $
  6. * Description:  XM_MAIN_WINDOW_WIDGET_CLASS
  7. * Author:       Niels Mayer, HPLabs
  8. * Created:      Sat Oct 28 03:35:05 1989
  9. * Modified:     Thu Oct  3 23:56:06 1991 (Niels Mayer) mayer@hplnpm
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       X11r5 contrib tape release
  13. *
  14. * WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  15. * XLISP version 2.1, Copyright (c) 1989, by David Betz.
  16. *
  17. * Permission to use, copy, modify, distribute, and sell this software and its
  18. * documentation for any purpose is hereby granted without fee, provided that
  19. * the above copyright notice appear in all copies and that both that
  20. * copyright notice and this permission notice appear in supporting
  21. * documentation, and that the name of Hewlett-Packard and David Betz not be
  22. * used in advertising or publicity pertaining to distribution of the software
  23. * without specific, written prior permission.  Hewlett-Packard and David Betz
  24. * make no representations about the suitability of this software for any
  25. * purpose. It is provided "as is" without express or implied warranty.
  26. *
  27. * HEWLETT-PACKARD AND DAVID BETZ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
  28. * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  29. * IN NO EVENT SHALL HEWLETT-PACKARD NOR DAVID BETZ BE LIABLE FOR ANY SPECIAL,
  30. * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  31. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  32. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  33. * PERFORMANCE OF THIS SOFTWARE.
  34. *
  35. * See ./winterp/COPYRIGHT for information on contacting the authors.
  36. * Please send modifications, improvements and bugfixes to mayer@hplabs.hp.com
  37. * Post XLISP-specific questions/information to the newsgroup comp.lang.lisp.x
  38. *
  39. ********************************************************************************
  40. */
  41. static char rcs_identity[] = "@(#)$Header: wc_MainW.c,v 1.3 91/03/14 03:14:51 mayer Exp $";
  42.  
  43. #include <stdio.h>
  44. #include <Xm/Xm.h>
  45. #include <Xm/MainW.h>
  46. #include "winterp.h"
  47. #include "user_prefs.h"
  48. #include "xlisp/xlisp.h"
  49. #include "w_funtab.h"
  50.  
  51.  
  52. extern Widget Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(); /* w_classes.c */
  53.  
  54.  
  55. /******************************************************************************
  56.  * (send <mainwinwidget> :SET_AREAS <menu> <command> <hscroll> <vscroll>
  57.  *                                  <workregion>)
  58.  *      ==> returns <mainwinwidget>.
  59.  * This method is used to attach children to be managed by an instance of
  60.  * XM_MAIN_WINDOW_WIDGET_CLASS. <menu> <command> <hscroll> <vscroll>
  61.  * and <workregion> are all WIDGETOBJs. If you don't want to set
  62.  * the particular region, pass NIL as the argument for the particular widget.
  63.  * 
  64.  * void XmMainWindowSetAreas(mw, menu, command, hscroll, vscroll, wregion)
  65.  *     XmMainWindowWidget mw;
  66.  *     Widget menu;
  67.  *     Widget command;
  68.  *     Widget hscroll;
  69.  *     Widget vscroll;
  70.  *     Widget wregion;
  71.  ******************************************************************************/
  72. LVAL Xm_Main_Window_Widget_Class_SET_AREAS()
  73. {
  74.   LVAL self, widgetobj;
  75.   Widget widget_id, menu, command, hscroll, vscroll, wregion;
  76.  
  77.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self); /*  get <self> */
  78.  
  79.   if (moreargs() && (*xlargv == NIL)) { /* get <menu> */
  80.     menu = NULL;
  81.     nextarg();
  82.   }
  83.   else
  84.     menu = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  85.  
  86.   if (moreargs() && (*xlargv == NIL)) { /* get <command> */
  87.     command = NULL;
  88.     nextarg();
  89.   }
  90.   else
  91.     command = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  92.  
  93.   if (moreargs() && (*xlargv == NIL)) { /* get <hscroll> */
  94.     hscroll = NULL;
  95.     nextarg();
  96.   }
  97.   else
  98.     hscroll = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  99.  
  100.   if (moreargs() && (*xlargv == NIL)) { /* get <vscroll> */
  101.     vscroll = NULL;
  102.     nextarg();
  103.   }
  104.   else
  105.     vscroll = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  106.  
  107.   if (moreargs() && (*xlargv == NIL)) { /* get <workregion> */
  108.     wregion = NULL;
  109.     nextarg();
  110.   }
  111.   else
  112.     wregion = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&widgetobj);
  113.  
  114.   xllastarg();
  115.  
  116.   XmMainWindowSetAreas(widget_id, menu, command, hscroll, vscroll, wregion);
  117.  
  118.   return (self);
  119. }
  120.  
  121.  
  122. /******************************************************************************
  123.  * (send <mainwinwidget> :SEP1)
  124.  *       ==> returns the WIDGETOBJ corresponding to the first separator widget.
  125.  *
  126.  * Widget XmMainWindowSep1(w)
  127.  *  Widget w;
  128.  ******************************************************************************/
  129. LVAL Xm_Main_Window_Widget_Class_SEP1()
  130. {
  131.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ();
  132.   LVAL self;
  133.   Widget widget_id;
  134.  
  135.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  136.   xllastarg();
  137.   
  138.   return (Wcls_WidgetID_To_WIDGETOBJ(XmMainWindowSep1(widget_id)));
  139. }
  140.  
  141.  
  142. /******************************************************************************
  143.  * (send <mainwinwidget> :SEP2)
  144.  *       ==> returns the WIDGETOBJ corresponding to the second separator widget.
  145.  *
  146.  * Widget XmMainWindowSep2(w)
  147.  *  Widget w;
  148.  ******************************************************************************/
  149. LVAL Xm_Main_Window_Widget_Class_SEP2()
  150. {
  151.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ();
  152.   LVAL self;
  153.   Widget widget_id;
  154.  
  155.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  156.   xllastarg();
  157.   
  158.   return (Wcls_WidgetID_To_WIDGETOBJ(XmMainWindowSep2(widget_id)));
  159. }
  160.  
  161.  
  162. #ifdef WINTERP_MOTIF_11
  163. /******************************************************************************
  164.  * (send <mainwinwidget> :SEP3)
  165.  *       ==> returns the WIDGETOBJ corresponding to the third separator widget.
  166.  *
  167.  * Widget XmMainWindowSep3(w)
  168.  *  Widget w;
  169.  ******************************************************************************/
  170. LVAL Xm_Main_Window_Widget_Class_SEP3()
  171. {
  172.   extern LVAL Wcls_WidgetID_To_WIDGETOBJ();
  173.   LVAL self;
  174.   Widget widget_id;
  175.  
  176.   widget_id = Wcls_Get_WIDGETOBJ_Argument_Returning_Validated_WidgetID(&self);
  177.   xllastarg();
  178.   
  179.   return (Wcls_WidgetID_To_WIDGETOBJ(XmMainWindowSep3(widget_id)));
  180. }
  181. #endif                /* WINTERP_MOTIF_11 */
  182.  
  183. /******************************************************************************
  184.  *
  185.  ******************************************************************************/
  186. Wc_MainW_Init()
  187. {
  188.   LVAL o_XM_MAIN_WINDOW_WIDGET_CLASS;
  189.   extern LVAL Wcls_Create_Subclass_Of_WIDGET_CLASS(); /* w_classes.c */
  190.   extern      xladdmsg();    /* from xlobj.c */
  191.  
  192.   o_XM_MAIN_WINDOW_WIDGET_CLASS =
  193.     Wcls_Create_Subclass_Of_WIDGET_CLASS("XM_MAIN_WINDOW_WIDGET_CLASS",
  194.                      xmMainWindowWidgetClass);
  195.  
  196.   xladdmsg(o_XM_MAIN_WINDOW_WIDGET_CLASS, ":SET_AREAS",
  197.        FTAB_Xm_Main_Window_Widget_Class_SET_AREAS);
  198.  
  199.   xladdmsg(o_XM_MAIN_WINDOW_WIDGET_CLASS, ":SEP1",
  200.        FTAB_Xm_Main_Window_Widget_Class_SEP1);
  201.  
  202.   xladdmsg(o_XM_MAIN_WINDOW_WIDGET_CLASS, ":SEP2",
  203.        FTAB_Xm_Main_Window_Widget_Class_SEP2);
  204.  
  205. #ifdef WINTERP_MOTIF_11
  206.   xladdmsg(o_XM_MAIN_WINDOW_WIDGET_CLASS, ":SEP3",
  207.        FTAB_Xm_Main_Window_Widget_Class_SEP3);
  208. #endif                /* WINTERP_MOTIF_11 */
  209.  
  210. }
  211.